Skip to content

Adds is_null function to RowAccessor#9979

Open
choubacha wants to merge 3 commits into
apache:mainfrom
choubacha:choubacha-adds-is-null-to-row-accessor
Open

Adds is_null function to RowAccessor#9979
choubacha wants to merge 3 commits into
apache:mainfrom
choubacha:choubacha-adds-is-null-to-row-accessor

Conversation

@choubacha
Copy link
Copy Markdown

Which issue does this PR close?

Rationale for this change

When dealing with parquet files directly, having a built in option for checking for nulls is useful when reading the rows out of the file. This function allows gating calls to the other accessors so that they can be mapped to None instead of relying on errors or accessing the field vec itself.

Are these changes tested?

Yes, a test was added.

Are there any user-facing changes?

This does add to the Row api. The trait function has a documentation block.

When dealing with parquet files directly, having a built in option for
checking for nulls is useful when reading the rows out of the file. This
function allows gating calls to the other accessors so that they can be
mapped to None instead of relying on errors or accessing the field vec
itself.

Fixes apache#8076
@github-actions github-actions Bot added the parquet Changes to the parquet crate label May 15, 2026
@choubacha
Copy link
Copy Markdown
Author

Whoops, fixed the implementation and eliminated the Result as it's not actually needed.

@choubacha
Copy link
Copy Markdown
Author

choubacha commented May 21, 2026

Also noticing that these accessor functions appear to panic if you go out of bounds. I'd like to update those index operations with get so that they don't panic. I believe returning ParquetError::IndexOutOfBounds would be sufficient?

Comment thread parquet/src/record/api.rs
if let Some((_, v)) = self.fields.get(i) {
v
} else {
&"<IndexOutOfBound>"
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure if this should be something different so if you have another recommendation feel free to weigh in.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems fine to me

Copy link
Copy Markdown
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me -- thank you @choubacha

Comment thread parquet/src/record/api.rs
if let Some((_, v)) = self.fields.get(i) {
v
} else {
&"<IndexOutOfBound>"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems fine to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parquet Changes to the parquet crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't read nulls via RowAccessor

2 participants